﻿using BLLTarasca;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Mail;
using System.Threading;
using System.Web;
using System.Web.Mvc;

namespace Tarasca.Controllers
{
    public class BaseController: Controller
    {
        protected override void ExecuteCore()
        {
            base.ExecuteCore();
        }

        protected List<TA_MedioDePago> OrdenarMediosDePago(List<TA_MedioDePago> lista)
        {
            TA_MedioDePago otro = lista.Where(b => b.Nombre.ToLower().Equals("otro")).FirstOrDefault();
            lista.Remove(otro);
            lista = lista.OrderBy(b => b.Nombre).ToList();
            lista.Add(otro);

            return lista;
        }

        protected bool ValidarEmail(string email)
        {
            try
            {
                MailAddress mail = new MailAddress(email);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}